import java.util.Scanner;

/**
 * @author ShenTuZhiGang
 * @version 1.0.0
 * @email 1600337300@qq.com
 * @date 2021-09-18 18:03
 */
public class ExamNetEase2021091801 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String str = String.valueOf(n);
        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) != '0' && n % (str.charAt(i) - '0') == 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}
